//
//  AllStarredChannelsCollectionViewCell.m
//  TestApplication
//
//  Created by Hanlingyu on 16/9/2.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "AllStarredChannelsCollectionViewCell.h"
#import "HomeChannels.h"

#import "UIImageView+WebCache.h"
@interface AllStarredChannelsCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *allChannelTitleLabel;
@property (weak, nonatomic) IBOutlet UILabel *allChannelContentLabel;
@property (weak, nonatomic) IBOutlet UIImageView *firstImageOfAllChannel;
@property (weak, nonatomic) IBOutlet UIImageView *secondImageOfAllChannel;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImageOfAllChannel;
@property (weak, nonatomic) IBOutlet UIImageView *fourthImageOfAllChannel;
@property (weak, nonatomic) IBOutlet UIImageView *hasNewPostImageView;


@end


@implementation AllStarredChannelsCollectionViewCell

- (void)awakeFromNib {
    // Initialization code
}


- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
}

- (void)setHomeChannel:(HomeChannels *)homeChannel {
    _homeChannel = homeChannel;
    _allChannelTitleLabel.text = _homeChannel.content;
    _allChannelContentLabel.text = _homeChannel.desc;
    NSArray *imageArray = [NSArray array];
    imageArray = _homeChannel.imgs;
    
// 图片赋值并对原图进行填充裁剪
    [_firstImageOfAllChannel sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", imageArray[0]]]];
    _firstImageOfAllChannel.contentMode = UIViewContentModeScaleAspectFill;
    _firstImageOfAllChannel.layer.masksToBounds = YES;
    
    [_secondImageOfAllChannel sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", imageArray[1]]]];
    _secondImageOfAllChannel.contentMode = UIViewContentModeScaleAspectFill;
    _secondImageOfAllChannel.layer.masksToBounds = YES;
    
    [_thirdImageOfAllChannel sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", imageArray[2]]]];
    _thirdImageOfAllChannel.contentMode = UIViewContentModeScaleAspectFill;
    _thirdImageOfAllChannel.layer.masksToBounds = YES;
    
    [_fourthImageOfAllChannel sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://qn.zheli.io/%@", imageArray[3]]]];
    _fourthImageOfAllChannel.contentMode = UIViewContentModeScaleAspectFill;
    _fourthImageOfAllChannel.layer.masksToBounds = YES;

#warning 小红点消失

    if (_homeChannel.newCount == 0) {
        _hasNewPostImageView.hidden = YES;
    }
    
    
    
}

@end
